﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using JihankiLib;

namespace GuiJihanki
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            var jihanki = new Jihanki();
            var iMachine = new JihankiItemBoxMachine();
            var mMachine = new MoneyBoxMachine();
            jihanki.Initialize(mMachine, iMachine);
            moneyBoxControl1.Initialize(mMachine);
            jihankiItemBoxPanel1.Initialize(iMachine);
            jihanki.Run();

            mMachine.RejectedAllMoney += new EventHandler<RejectedAllMoneyEventArgs>(moneyBox_RejectedAllMoney);
        }

        void moneyBox_RejectedAllMoney(object sender, RejectedAllMoneyEventArgs e)
        {
            lblStatus.Text = String.Format("{0}円排出されました。", e.RejectedValue.Value);
        }
    }
}
